<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="layout :: htmlhead" th:with="title='文章管理'"></head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!--头-->
    <div th:replace="fragments/head :: header"></div>

    <div class="layui-body" style="margin: 1%">

        <form id="userSearch" class="layui-form layui-form-pane" method="post" action="" style="margin-top: 20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">文章标题</label>
                <div class="layui-input-inline" >
                    <input id="title" name="title" autocomplete="off" class="layui-input" type="text" style="width: 320px;"/>
                </div>
            </div>

            <div class="layui-form-item  layui-col-md4">
                <label class="layui-form-label">所属部门</label>
                <div class="layui-input-block">
                    <select name="menuId" id="menuId" autocomplete="off">
                        <option value=""></option>
                    </select>
                </div>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <button class="layui-btn"  lay-submit="" lay-filter="searchSubmit">提交</button>
            </div>

        </form>

        <!--水平线颜色-->
        <!--<hr class="layui-bg-blue"/>-->
        <hr class="layui-bg-black"/>

        <button class="layui-btn layui-btn-normal" onclick="addArticle()">新增文章</button>

        <table id="uesrList" lay-filter="userTable"></table>
        <div style="display:none;" id="currentUser">
            <shiro:principal property="id"></shiro:principal>
        </div>
        <script type="text/html" id="optBar1">
            {{#  if(d.status==0){ }}
            <span>已发布</span>
            {{#  } else { }}
            <span>草稿</span>
            {{#  } }}
        </script>

        <script type="text/html" id="optBar">
            <!--            <a class="layui-btn layui-btn-xs" lay-event="select">查看</a>-->
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </div>

    <!--底部-->
    <div th:replace="fragments/footer :: footer"></div>
    <script src="/js/dateUtils.js"></script>
    <script src="/js/article/articleList.js"></script>
    <script type="text/javascript" src="/layui/layui.all.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'upload', 'layer'], function () {

            var form = layui.form;
            //回显搜索Form导航菜单列表
            $.ajax({
                url: '/menu/getMenus',
                dataType: 'json',
                type: 'get',
                success: function (data) {
                    $.each(data, function (index, item) {
                        $('#menuId').append(new Option(item.cname, item.cid));
                    });
                    layui.form.render("select");

                    //重新渲染 固定写法
                }
            });
        });


    </script>

</div>
</body>
</html>